package chapter2;

public class 选择排序 {
    public static void main(String[] args) {
        int[] nums = {1,4,2,5,7,3};

        for(int j=0;j<nums.length;j++){
            int max = 0;
            for(int i=0; i<nums.length - j; i++){
                if(nums[max] <nums[i]){
                    max = i;
                }

                int t = nums[nums.length - j -1];
                nums[nums.length -j -1] = nums[max];
                nums[max] = t;

            }
        }

        for (int num : nums) {
            System.out.println(num);
        }
    }
}
